<template>
	<view class="MyLike">
		<u-navbar title="我喜欢" back-icon-color="#fff" :background="background" title-color="#fff"></u-navbar>
		<view class="u-page">
			<view class="content">
				<view class="item" v-for="(item, index) in sonList" :key="item.id" @click="goPlayer(index)">
					<view class="left">
						<view class="box">
							<u-image :src="item.musicImg"  width="80rpx" height="80rpx" bg-color="#000"></u-image>
						</view>
					</view>
					<view class="right">
						<text class="songName">{{item.musicName}}</text>
						<text class="fuHao"> —— </text>
						<text class="personName">{{item.singer}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState, mapMutations } from "vuex"
	export default {
		data() {
			return {
				background: {},
				textColor: "",
				sonList: [],
				query: {},
			}
		},
		computed: {
			...mapState({
				list:({config})=>config.tabBarList,
				commonColor: ({config})=>config.commonColor,
				openid: ({config})=>config.openid,
			})
		},
		methods: {
			...mapMutations({
				SET_List: "config/SET_List",
				SET_index: "config/SET_index",
			}),
			getList() {
				this.$http.get("/queryUserLikeSong.htm", {
					userId: this.openid
				}).then(res => {
					this.sonList = res.result;
				})
			},
			goPlayer(index) {
				this.SET_List(this.sonList);
				this.SET_index(index);
				uni.navigateTo({
					url: "/pages/Player/Player"
				})
			}
		},
		created() {
			this.background["backgroundColor"] = this.commonColor;
			this.textColor= this.commonColor;
		},
		onLoad(){
			this.getList();
		}
	}
</script>

<style lang="less" scoped>
.MyLike {
	display: flex;
	flex-direction: column;
	height: 100%;
	.u-page {
		flex: 1;
		overflow: hidden;
		padding: 20rpx;
		.content {
			background-color: #fff;
			border-radius: 10rpx;
			.item {
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				width: 100%;
				padding: 20rpx 0;
				.left {
					padding: 0 20rpx;
					.box {
						display: flex;
						justify-content: center;
						align-items: center;
						width: 80rpx;
						height: 80rpx;
						// background-color: #000;
						opacity: .1;
						border-radius: 10rpx;
					}
				}
				.right {
					font-size: 30rpx;
					letter-spacing: 3rpx;
					.songName {}
					.fuHao {
						padding: 0 20rpx;
					}
					.personName {
						font-size: 20rpx;
						color: #999;
					}
				}
			}
		}
	}
}
</style>
